<template>
	<view class="setup">
<!-- 		<view v-if="showDiv" class="setupheadImg" @click="upfile()">
			<view class="icon">
				<image src="../../../../static/img/my/hadeImg.png" mode=""></image>
			</view>
			<text>修改头像</text>
			<view class="iconYou">
				<image src="../../../../static/img/my/iconyou.png" mode=""></image>
			</view>
		</view> -->
		<view @click="toghNum()" class="setupheadImg">
			<view class="icon">
				<image src="../../../../static/img/my/pohoImg.png" mode=""></image>
			</view>
			<text>修改手机</text>
			<view class="iconYou">
				<image src="../../../../static/img/my/iconyou.png" mode=""></image>
			</view>
		</view>
	<!-- 	<view class="setupheadImg" @click="toModify()">
			<view class="icon">
				<image src="../../../../static/img/my/pohoImg.png" mode=""></image>
			</view>
			<text>修改支付宝</text>
			<view class="iconYou">
				<image src="../../../../static/img/my/iconyou.png" mode=""></image>
			</view>
		</view> -->
		<!-- <view class="setupheadImg">
			<view class="icon">
				<image src="../../../../static/img/my/pohoImg.png" mode=""></image>
			</view>
			<text>修改微信</text>
			<view class="iconYou">
				<image src="../../../../static/img/my/iconyou.png" mode=""></image>
			</view>
		</view> -->
		<view @click="signout()" class="setupheadImg">
			<view class="icon">
				<image src="../../../../static/img/my/out.png" mode=""></image>
			</view>
			<text>退出登录</text>
			<view class="iconYou">
				<image src="../../../../static/img/my/iconyou.png" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapMutations, mapState} from 'vuex'
	export default {
		data() {
			return {
				showDiv: true,
			}
		},
		onLoad() {
			// #ifdef MP-WEIXIN
				this.showDiv = false
			// #endif
		},
		computed: {
			...mapState(['userInfo'])
		},
		methods: {
			...mapMutations(['logout']),
			toghNum() {
				uni.navigateTo({
					url:'./ghphoneNum'
				})
			},
			signout() {
				var that = this
				uni.showModal({
				    title: '提示',
				    content: '是否退出登录？',
				    success: function (res) {
				        if (res.confirm) {
				            that.logout(res)
							uni.reLaunch({
								url: '../../login/login'
							})
				        } else if (res.cancel) {
				            console.log('用户点击取消');
				        }
				    }
				});
			},
			toModify() {
				uni.navigateTo({
					url: '../withdrawalMoney/modifyNumder'
				})
			},
			upfile(){
				// let _this = this;
				// uni.chooseImage({ // 从本地相册选择图片或使用相机拍照。
				// 	count: 1,//默认选择1张图片
				// 	sizeType: ['original', 'compressed'],//original 原图，compressed 压缩图，默认二者都有
				// 	success:  (res)=> {
				// 		console.log(res.tempFilePaths[0]);//成功则返回图片的本地文件路径列表 tempFilePaths
				// 		uni.uploadFile({//将本地资源上传到开发者服务器
				// 			url:baseURL+'/index.php/api/index/upload', //接口地址
				// 			filePath: res.tempFilePaths[0],//图片地址
				// 			name: 'file',
				// 			formData:{
				// 				access_token:uni.getStorageSync('access_token'),//加入token
				// 			},
				// 			success: (uploadFileRes) => {
				// 				let data = JSON.parse(uploadFileRes.data)
				// 				if(data.code ==1){
				// 					this.my_avatar = data.data.url;//上传成功后返回的图片地址
				// 				}
				// 			}
				// 		});
				// 	}
				// });
				uni.navigateTo({
					url: './hadeImg'
				})
			},
			
		}
	}
</script>

<style lang="scss" scoped>
	.setup {
		padding: 0 32rpx;
		.setupheadImg {
			display: flex;
			padding: 32rpx 0;
			border-bottom: 2rpx dashed #979797;
			position: relative;
			.icon image,.iconYou image {
				width: 100%;
				height: 100%;
			}
			.icon {
				width: 40rpx;
				height: 40rpx;
				padding-right: 20rpx;
			}
			text {
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #666666;
				line-height: 40rpx;
			}
			.iconYou {
				width: 16rpx;
				height: 28rpx;
				position: absolute;
				right: 0;
			}
		}
	}
</style>
